<?php
class Gome_MasterController extends Clu_Controller_Action_Master
{
	public $m,$c;//, $mPlace, $mArticle;
	public $tl;
	
	public function init()
	{
		//require_once (APP_PATH.'/modules/category/Model/Category.php');
		//require_once (APP_PATH.'/modules/news/Model/News.php');
		//require_once (APP_PATH.'/modules/article/Model/Article.php');
		//require_once (APP_PATH.'/modules/user/Model/User.php');
		$this->c = new category_Model_Category();
		$this->mArticle = new article_Model_Service();
		$this->n = new Model_News();
		parent::init();
	}
	
	public function homeAction()
	{
		$sess = new Zend_Session_Namespace(CLU_NS);
		$this->viewParams['language'] = $sess->viewLang;
		$vision = $this->n->getNewsData(1, true, 'array'); //vision
		$this->viewParams['vision'] = $vision;
		$ph = $this->n->getNewsData(2, true, 'array');
		$this->viewParams['philosophy'] = $ph;

		$m = $this->n->getNewsData(3, true, 'array');
		$this->viewParams['mission'] = $m;
		
		$this->paramsForWidgets = array('param1' => $this->n,//$this->generateCommonBoxes(),
										'param2' => $sess->viewLang
										);

	}
	
	public function newsAction() 
	{
		$sess = new Zend_Session_Namespace(CLU_NS);
		$this->viewParams['language'] = $sess->viewLang;
		
		$id = $this->_request->getParam('id');
//		$news = $this->n->getNewsData($id, true, 'array');
//		$this->viewParams['news'] = $news;
		
		$this->view->placeholder('currentMenu')->set($this->_request->getParam('menu'));
		
		$this->view->placeholder('currentIndex')->set($this->_request->getParam('index'));
		
		
		$this->paramsForWidgets = array('param1' => $this->n->getNewsData($id, true, 'array'),
										'param2' => $sess->viewLang,
										'param3' => $this->n,//$this->generateCommonBoxes()
										);
	}
	
	public function listNewsAction() 
	{	
		$sess = new Zend_Session_Namespace(CLU_NS);
		$this->viewParams['language'] = $sess->viewLang;
//		$latest = $this->n->getLatestRecruitments();
//		$this->viewParams['latest'] = $latest;
		$this->view->placeholder('currentMenu')->set($this->_request->getParam('menu'));
		$this->view->placeholder('currentIndex')->set($this->_request->getParam('index'));
		
		$this->paramsForWidgets = array('param1' => $this->n,//$this->generateCommonBoxes(),
										'param2' => $sess->viewLang
										);
										
	}
	
	public function generatePaginator($select, $pageNumber, $itemsPerPage, $pageRange, $style)
    {
        $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select));
        $paginator->setItemCountPerPage($itemsPerPage);
        $paginator->setCurrentPageNumber($pageNumber);
        $paginator->setPageRange($pageRange);
        Zend_Paginator::setDefaultScrollingStyle($style);
        return $paginator;
    }

	public function successAction()
    {
         $this->view->tid =  $this->_request->getParam("tid");
         $this->renderToHolder( 'common/success.phtml');  
    }
}
?>